package com.z6school.manage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.z6school.manage.common.pojo.UserDeptVo;
import com.z6school.manage.po.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper extends BaseMapper<User> {

    int getRowCount(String username);

    List<UserDeptVo> findPageObjects(
            String  username,
            Integer startIndex,
            Integer pageSize);

    @Select("select * from user where username=#{username}")
    User findUserByUserName(String username);

    @Update("update user set password=#{password},salt=#{salt},modifiedTime=now() where id=#{id}")
    int updatePassword(
            @Param("password")String password,
            @Param("salt")String salt,
            @Param("id")Integer id);
}
